<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admenvboxtypeliste.php,v $ 
 * $Date: 2005/08/29 13:18:22 $ 
 * $Revision: 1.2 $ 
 * 
 * ********* CVS HEADER ********* 
 */
$L_base_env = get_env_path();
require_once(get_path("module")."TPLN/TPLN.php");
$TPLN = new TPLN;
$TPLN->Open($op_basepath.get_path("tpl")."admenvboxtypeliste.html");
$TPLN->IncludeFile("header",$L_base_env.$session['environnement']."/header.php");

require_once(get_path_module("admin")); 
$pc = new panneau_controle(); 
$pc->calculRubriqueParFonction($op); 
$TPLN->Parse("panneau_controle",$pc->retourneEntete());

$query="SELECT * FROM rportal_boxtype";
$result=rportalrequete($query) or rportalerreur($query,"?op=admenvgest");
$class="liste_impaire";
$prompt='<?php ';
if(rportalnbresult($result)==0){
        $TPLN->EraseBloc("bloc1"); 
}
while($row=rportalligne($result))
{
    //$prompt.="require_once('box/$row[repertoire]/classe.php');\n";
    $prompt.="require_once(get_path_box('".$row['nom']."').'classe.php');\n";
    $TPLN->Parse("bloc1.classe",$class);
    $TPLN->Parse("bloc1.nom",$row['nom']);
    $TPLN->Parse("bloc1.description",nl2br($row['description']));
    $TPLN->Parse("bloc1.repertoire",$row['repertoire']);
    $TPLN->Parse("bloc1.id",$row['id']);
    if($class!="liste_impaire")
	{
		$class="liste_impaire";
	}else{
		$class="liste_paire";
	}
	$TPLN->Loop("bloc1");
}
if($argid!=0){
        $query="SELECT * FROM rportal_boxtype WHERE id='$argid'";
        $result=rportalrequete($query) or rportalerreur($query,"?op=admenvboxtypeliste");
        if($row=rportalligne($result)){
                $TPLN->Parse("form_nom",$row['nom']);
                $TPLN->Parse("form_description",htmlspecialchars($row['description']));
                $TPLN->Parse("form_repertoire",$row['repertoire']);
                $TPLN->Parse("form_id",$row['id']);
        }
}else{
        $TPLN->Parse("form_nom",'');
        $TPLN->Parse("form_description",'');
        $TPLN->Parse("form_repertoire",'');
        $TPLN->Parse("form_id",'0');
}
$TPLN->IncludeFile("footer",$L_base_env.$session['environnement']."/footer.php");
$TPLN->Write();
$fp = fopen(get_path("param")."environnement.php","w");
fwrite($fp, $prompt.' ?>');
fclose($fp);
?>
